package cn.wind.xboot.module.web.controller;

import cn.wind.xboot.core.res.ApiResult;
import cn.wind.xboot.framework.domain.PageVo;
import cn.wind.xboot.logic.cli.entity.CliInfo;
import cn.wind.xboot.logic.cli.service.ICliInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 *消费者管理
 * @author WangHao
 * @date 2018-12-26
 */
@Slf4j
@RequestMapping("customer")
@Controller
public class CustomerController {
    @Autowired
    private ICliInfoService cliInfoService;

    /**
     * 消费者分页列表展示
     * @return searchName搜索参数
     */
    @RequestMapping("/list")
    @ResponseBody
    public ApiResult list(PageVo pageVo,String searchName,String province,String city,String district){
        Map<String,Object> map = Maps.newHashMap();
        map.put("searchName",searchName);
        map.put("province",province);
        map.put("city",city);
        map.put("district",district);
        IPage<CliInfo> page = cliInfoService.findAll(pageVo.init(),map);
        return ApiResult.Custom().success("查询成功").add(page);
    }
}
